package com.cxm.helper.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.cxm.helper.pojo.dto.MessageListDTO;
import com.cxm.helper.service.MessageService;
import com.cxm.helper.util.ResponseEntity;
import com.cxm.helper.util.request.PageRequest;
import com.cxm.helper.util.response.PageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: chenximeng
 * @date: 2022/12/3 14:51
 */
@RestController
@RequestMapping("/msg")
public class MessageController {

    @Autowired
    MessageService messageService;

    @PostMapping("/list")
    public ResponseEntity list(@RequestBody MessageListDTO request) {
        return ResponseEntity.ok(messageService.pageList(request));
    }

    @PostMapping("/getNewMsgNum")
    public ResponseEntity list() {
        return ResponseEntity.ok(messageService.getNewMsgNum(StpUtil.getLoginIdAsLong()));
    }
}
